package cn.msi.contract.action;

import cn.common.action.GeneralAction;
import cn.msi.contract.domain.Contract;
import cn.msi.contract.domain.ContractChange;
import cn.msi.contract.service.ContractService;

/**
 * 合同请求处理Action
 * 
 * @author Administrator
 * 
 */
public class ContractAction extends GeneralAction {

	private static final long serialVersionUID = 1638825093701785344L;

	private Contract contract = new Contract();

	private ContractChange contractChange = new ContractChange();

	private ContractService contractService;

	private String operator;

	/**
	 * 查询合同请求
	 * 
	 * @throws Exception
	 */
	public void searchContractList() throws Exception {
		page(contract);
		String json = contractService.searchContract(contract);
		out(json);
	}

	/**
	 * 查询作废合同请求
	 * 
	 * @throws Exception
	 */
	public void searchChannelContractList() throws Exception {
		page(contract);
		String json = contractService.searchChannelContract(contract);
		out(json);
	}
	
	/**
	 * 合同变更历史请求
	 * 
	 * @throws Exception
	 */
	public void searchContractHisList() throws Exception {
		page(contractChange);
		String json = contractService.searchContractHisList(contractChange);
		out(json);
	}

	/**
	 * 查找合同
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findContract() throws Exception {
		contract = contractService.findContract(contract);
		return SUCCESS;
	}

	/**
	 * 合同变更界面
	 * 
	 * @return
	 * @throws Exception
	 */
	public String findRepactContract() throws Exception {
		contract = contractService.findContract(contract);
		return SUCCESS;
	}

	/**
	 * 新增用户合同
	 * 
	 * @throws Exception
	 */
	public void addContract() throws Exception {
		contractService.addContract(contract);
	}

	/**
	 * 合同内容变更
	 * 
	 * @throws Exception
	 */
	public void addContractChange() throws Exception {
		contractService.addContractChange(contract, contractChange);
	}

	/**
	 * 审核合同
	 * 
	 * @throws Exception
	 */
	public void autContract() throws Exception {
		contractService.autContract(contract);
	}

	/**
	 * 合同作废
	 * 
	 * @throws Exception
	 */
	public void channelContract() throws Exception {
		contractService.channelContract(contract);
	}

	public Contract getContract() {
		return contract;
	}

	public void setContract(Contract contract) {
		this.contract = contract;
	}

	public void setContractService(ContractService contractService) {
		this.contractService = contractService;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public ContractChange getContractChange() {
		return contractChange;
	}

	public void setContractChange(ContractChange contractChange) {
		this.contractChange = contractChange;
	}
}
